<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Api extends CI_Controller 
{	
  	function __construct()
  	{
  		parent::__construct();
  	    $this->load->model('apimodel');
  	    $this->load->helper('time');
  	}
  	
	public function addComment()
	{
	    $_POST['user_id'] = $_SESSION['userLoggedIn']['id'];
		$status = $this->apimodel->addComment($_POST);
		if ($status) {
		    echo json_encode(array('status'=>1,
		    					   'data'=>array('avatar' => 'adf')
		                      ));
		} else {
		    echo '{"status":0,"errors":"error whenr insert to db"}';
		}
	}
	
}